package org.mspring.mlog.service;

import org.mspring.mlog.dao.RoleNodeEntityDao;
import org.mspring.mlog.entity.RoleNodeEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Gao Youbo
 * @since 2015-01-02 14:25
 */
@Service
public class RoleNodeEntityService {
    private RoleNodeEntityDao roleNodeEntityDao;

    public RoleNodeEntity findById(long id) {
        return roleNodeEntityDao.findById(id);
    }

    @Transactional
    public boolean insert(RoleNodeEntity roleNode) {
        return roleNodeEntityDao.insert(roleNode);
    }


    @Transactional
    public boolean update(RoleNodeEntity roleNode) {
        return roleNodeEntityDao.update(roleNode);
    }

    @Transactional
    public boolean deleteById(long id) {
        return roleNodeEntityDao.deleteById(id);
    }

    /**
     * 删除所有
     *
     * @return
     */
    @Transactional
    public boolean deleteAll() {
        return roleNodeEntityDao.deleteAll();
    }

    @Autowired
    public void setRoleNodeEntityDao(RoleNodeEntityDao roleNodeEntityDao) {
        this.roleNodeEntityDao = roleNodeEntityDao;
    }
}
